package gam.n1.cm.i;

import gam.n1.areas.Area;
import gam.n1.areas.AreaManager;
import gam.n1.conf.ConfManager;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;

public class AreaSaveHandler extends  BaseHandler{
    public AreaSaveHandler(Plugin plugin) {
        super(plugin);
    }

    @Override
    public boolean handle(Player player, String[] args) throws Exception {
        if (args.length == 1) {
            String name = args[0];
            Area area = AreaManager.findArea(name);
            if (area != null){
                ConfManager.DVArea.save(area);
                ConfManager.Msg.send(player,"&aArea &5{name} &asaved successfully!","{name}",name);
                return true;
            }
            ConfManager.Msg.send(player,"&4Save failed, unknown Area name : &5{name}","{name}",name);
        }
        return false;
    }
}
